/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 
window.onload = addHoverToDatatableRows;*/
function addOnclickToDatatableRows() {
    var trs = document.getElementById("form:tabSetJugador:tabConsultar:tablaJugadores").getElementsByTagName('tbody')[0]
        .getElementsByTagName('tr');
    for (var i = 0; i < trs.length; i++) {
        trs[i].onclick = new Function("highlightAndSelectRow(this)");
    }
    var tabla=document.forms("form").namedItem("tablaJugadores");
    

}

function highlightAndSelectRow(tr) {
    var trs = document.getElementById("form:tabSetJugador:tabConsultar:tablaJugadores").getElementsByTagName('tbody')[0]
        .getElementsByTagName('tr');
    for (var i = 0; i < trs.length; i++) {
        if (trs[i] == tr) {
            trs[i].bgColor = '#ff0000';
            document.form.rowIndex.value = trs[i].rowIndex;
        } else {
            trs[i].bgColor = '#ffffff';
        }
    }
}